package lib

func init() {
	Probs = append(Probs, Problem{
		Num:         11,
		Discription: "装水最多的两条线构成的容器",
		Level:       2,
		Labels: map[string]int{
			"双指针滑动": 1,
			"贪心":  1,
		},
	})
}

func MaxArea(height []int) int {
	i := 0
	j := len(height) - 1
	maxVol := 0
	for i < j {
		maxVol = max(maxVol, min(height[i], height[j])*(j-i))
		//每次移动短板
		if height[i] < height[j] {
			i++
		} else {
			j--
		}
	}

	return maxVol
}